package com.szh.zx.gaoDingJavaBook.chapter7.two;

public class Dog implements Cloneable {
	String name;
	double weight;

	public Dog(String name, double weighet) {
		System.out.println("调用有参函数");
		this.name = name;
		this.weight = weighet;
	}

	@Override
	protected Object clone() throws CloneNotSupportedException {
		Dog dog = (Dog) super.clone();
		return dog;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj){
			return true;
		}
		if (obj.getClass() == Dog.class){
			Dog taiget= (Dog) obj;
			return taiget.name.equals(this.name) && taiget.weight == this.weight;
		}
		return false;
	}

	@Override
	public int hashCode() {
		return name.hashCode()*17+(int) weight;
	}
}
